import Vue from 'vue';
import Router from 'vue-router';

// 首页及章节页面
import HomePage from './components/HomePage.vue';
import OnePage from './components/PageOne.vue';
import TwoPage from './components/PageTwo.vue';
import ThreePage from './components/PageThree.vue';
import FourPage from './components/PageFour.vue';
import FivePage from './components/PageFive.vue';
import SixPage from './components/PageSix.vue';
import SevenPage from './components/PageSeven.vue';
import EightPage from './components/PageEight.vue';
import NinePage from './components/PageNine.vue';
import PageTen from '@/views/chapter/PageTen.vue'; // 已取消注释

// 用户通用页面
import Home from './components/Home.vue'; // 首页
import Detail from './components/Detail.vue'; // 详情页
import List from './components/List.vue'; // 列表页
import Child from './components/Child.vue'; // 子页面

// 用户模块
import LoginView from '@/views/user/LoginView.vue'
import RegisterView from '@/views/user/RegisterView.vue'
import HomeView from '@/views/user/HomeView.vue'

// 管理员模块
import AdminLogin from '@/views/admin/AdminLogin.vue'
import Dashboard from '@/views/admin/Dashboard.vue'
import Settings from '@/views/admin/Settings.vue'
import Users from '@/views/admin/Users.vue'
import Products from '@/views/admin/Products.vue'

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HomePage',
      component: HomePage,
    },
    {
      path: '/page-one',
      name: 'One',
      component: OnePage,
    },
    {
      path: '/page-two',
      name: 'Two',
      component: TwoPage,
    },
    {
      path: '/page-three',
      name: 'Three',
      component: ThreePage,
    },
    {
      path: '/page-four',
      name: 'Four',
      component: FourPage,
    },
    {
      path: '/page-five',
      name: 'Five',
      component: FivePage,
    },
    {
      path: '/page-six',
      name: 'Six',
      component: SixPage,
    },
    {
      path: '/page-seven',
      name: 'Seven',
      component: SevenPage,
    },
    {
      path: '/page-eight',
      name: 'Eight',
      component: EightPage,
    },
    {
      path: '/page-nine',
      name: 'Nine',
      component: NinePage,
    },
    {
      path: '/page-ten',
      name: 'Ten',
      component: PageTen,
      redirect: '/page-ten/home',
      children: [
        { path: 'home', component: HomeView },
        { path: 'admin/login', component: AdminLogin },
        {
          path: 'admin/dashboard',
          component: Dashboard,
          redirect: 'settings',
          children: [
            { path: 'settings', component: Settings },
            { path: 'users', component: Users },
            { path: 'products', component: Products }
          ]
        }
      ]
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail,
    },
    {
      path: '/list',
      name: 'List',
      component: List,
    },
    {
      path: '/child',
      name: 'Child',
      component: Child,
    },

    // 用户前台页面
    {
      path: '/user/home',
      name: 'UserHome',
      component: HomeView,
    },
    {
      path: '/login',
      name: 'Login',
      component: LoginView,
    },
    {
      path: '/register',
      name: 'Register',
      component: RegisterView,
    },
    // 管理员后台页面（已整合进 /page-ten）
    {
      path: '/admin',
      name: 'AdminDashboard',
      component: Dashboard,
      redirect: '/admin/settings',
      children: [
        { path: 'settings', component: Settings },
        { path: 'users', component: Users },
        { path: 'products', component: Products }
      ]
    },
  ]
});